import '@tarojs/async-await'
import Taro, { Component } from '@tarojs/taro'

import Index from './pages/index'

import './app.less'
import 'taro-ui/dist/style/index.scss' 

import  { set as setGlobalData }   from './util/global_data';

class App extends Component {
  config = {
    pages: [
      'pages/tarBar/summary/index',
      'pages/tarBar/personCenter/index',
      'pages/tarBar/coupons/index',
      'pages/accredit/index',
    ],
    window: {
      backgroundTextStyle: 'light',
      navigationBarBackgroundColor: '#ffffff',
      navigationBarTitleText: 'WeChat',
      navigationBarTextStyle: 'black'
    }
  }

  componentDidMount () {
    const res = Taro.getSystemInfoSync()
    console.log(res);
    let phoneModels = res.model;
    if (phoneModels.search('iPhone X') != -1) {
        setGlobalData('isIphoneX',true);
    }else{
      setGlobalData('isIphoneX',false);
    }
  }

  componentDidShow () {}

  componentDidHide () {}

  componentCatchError () {}

  componentDidCatchError () {}

  // 在 App 类中的 render() 函数没有实际作用
  // 请勿修改此函数
  render () {
    return (
      <Index />
    )
  }
}

Taro.render(<App />, document.getElementById('app'))
  